#!/usr/bin/python
# Filename: main.mi2app

import os
import sys
import shutil
import traceback

import mi2app_utils
from mobile_insight.monitor import OnlineMonitor, OfflineReplayer
from mobile_insight.analyzer import MobilityMngt


list_logEnabled = [
            'LTE_PHY_PDSCH_Packet',
            'LTE_MAC_DL_Transport_Block',
            'LTE_RLC_DL_AM_All_PDU',
            'LTE_RRC_OTA_Packet',
            'LTE_RRC_Serv_Cell_Info',
            'LTE_RRC_MIB_Packet',
            'LTE_RRC_MIB_Message_Log_Packet',
            'LTE_NAS_ESM_State',
            'LTE_NAS_ESM_OTA_Incoming_Packet',
            'LTE_NAS_ESM_OTA_Outgoing_Packet',
            'LTE_NAS_EMM_State',
            'LTE_NAS_EMM_OTA_Incoming_Packet',
            'LTE_NAS_EMM_OTA_Outgoing_Packet',
            'LTE_PHY_Connected_Mode_Intra_Freq_Meas',
            'LTE_PHY_RLM_Report',
            'LTE_PHY_PUSCH_CSF',
            'LTE_PHY_PDSCH_Stat_Indication'
            ]

try:
    cache_directory  = mi2app_utils.get_cache_dir()
    log_directory    = os.path.join(cache_directory, "mi2log")
    mi_directory = mi2app_utils.get_mobileinsight_path()

   
    src = OfflineReplayer()
    src.set_input_path(os.path.join(mi_directory,"demo/MobilityGraph/"))

    mobility_analyzer = MobilityMngt()
    mobility_analyzer.set_source(src)


    src.run()

except:
    src.log_error(traceback.format_exc())

# finally:
    # mi2app_utils.detach_thread()
    pass